//编写课程选项卡数据服务
const CourseTabModel = require('../db/models/courseTab');


class CourseTabService {
    async addCourseTabData(data){
       const cid = data.cid;
       const result = await CourseTabModel.findOne({
        where: { cid }
    });
    if(result) {
        return await CourseTabModel.update(data, {
            where: { cid }
        });
      }else {
        return await CourseTabModel.create(data);
      }
    }
    async getCourseFieldData () {
        return await CourseTabModel.findAll()
    }

}

module.exports = new CourseTabService();